﻿@using System.Data;
@using System.Web;
@using DTcms.Web.MVC.Areas.Web.Controllers;
@using DTcms.Web.MVC.UI.Controllers;
@using DTcms.Model;
@{
   Layout = "~/Areas/Web/Views/" + ViewBag.TemplateSkin + "/web/Shared/_LayoutList.cshtml";
   DTcms.Model.channel_site site = ViewData["site"] as DTcms.Model.channel_site;
   DTcms.Model.siteconfig config = ViewData["config"] as DTcms.Model.siteconfig;
   Article_ListController bc = ViewBag.BasePage as Article_ListController;
   DTcms.Model.article_category m = bc.model;
   ViewBag.Title = m.title + " - " + site.name;
   DataTable list = null;
   string channel = "news";
   int category_id = int.Parse(ViewBag.CategoryId as string);
   int count = 0;
   string category_nav = bc.get_category_menu("news_list", category_id);
   int pagesize = 20;
   int totalcount = 0;
   string pagelist = string.Empty;
   int page = int.Parse(ViewBag.Page as string);      
}

<div class="section clearfix">
  <div class="ntitle">
    <h2>
      <a href="javascript:;">@m.title</a>
    </h2>
    <span>当前位置：<a href="@bc.linkurl("index")">首页</a> &gt; <a href="@bc.linkurl("news")">新闻资讯</a>@Html.Raw(category_nav)</span>
  </div>
  
  <!--右边-->
  <div class="list-right">
    <div class="sidebar-box">
      <div class="line30"></div>
      <h3>资讯类别</h3>
      <ul class="navbar">
        @{ 
        DataTable categoryList1 = bc.get_category_child_list(channel, 0);
        foreach(DataRow cdr1 in categoryList1.Rows){
        <li>
          <h4><a href="@bc.linkurl("news_list",cdr1["id"])">@cdr1["title"]</a></h4>
          <p>
            @{ 
            DataTable categoryList2 = bc.get_category_child_list(channel, Convert.ToInt32(cdr1["id"]));
            foreach(DataRow cdr2 in categoryList2.Rows){
               if(Convert.ToInt32(@cdr2["id"]) == category_id){
               <a href="@bc.linkurl("news_list",cdr2["id"])" class="selected">@cdr2["title"]</a>
               }else{
               <a href="@bc.linkurl("news_list",cdr2["id"])">@cdr2["title"]</a>
               }
            }
            }
          </p>
        </li>
        }
        }
      </ul>
      <div class="line20"></div>
      <h3>推荐资讯</h3>
      <div class="focus-list">
        <ul>
          @{ 
          DataTable redNews = bc.get_article_list(channel, 0, 4, "status=0 and is_red=1 and img_url<>''");
          foreach(DataRow reddr in redNews.Rows){
          <li>
            <a title="@reddr["title"]" href="@bc.linkurl("news_show",reddr["id"])">
              <b><img src="@reddr["img_url"]" /></b>
              <span>@reddr["title"]</span>
            </a>
          </li>
          }
          }
        </ul>
      </div>
      <div class="line10"></div>
      <h3>人气排行</h3>
      <ul class="rank-list">
        @{ 
        DataTable hotNews = bc.get_article_list(channel, 0, 10, "status=0", "click desc,id desc");
        int hotcount = 0;
        foreach(DataRow hotdr in hotNews.Rows){
           hotcount ++;
           if(hotcount==1){
           <li class="active">
             <span>@DateTime.Parse(hotdr["add_time"].ToString()).ToString("MM-dd")</span>
           <i class="num">@hotcount</i><a href="@bc.linkurl("news_show",hotdr["id"])">@hotdr["title"]</a>
           </li>
           }else{
           <li>
             <span>@DateTime.Parse(hotdr["add_time"].ToString()).ToString("MM-dd")</span>
             <i class="num">@hotcount</i><a href="@bc.linkurl("news_show",hotdr["id"])">@hotdr["title"]</a>
           </li>
           }
        }
        }
      </ul>
      
    </div>
  </div>
  <!--/右边-->
  
  <!--左边-->
  <div class="list-auto">
    <ul class="n-list">
      @{ 
      DataTable newsList = bc.get_article_list(channel, category_id, pagesize, page, "status=0", out totalcount, out pagelist, "news_list", category_id, "__id__");<!--取得一个分页DataTable-->
      foreach(DataRow dr in newsList.Rows){
      <li>
        <h2><a href="@bc.linkurl("news_show",dr["id"])">@dr["title"]</a></h2>
        <div class="note">
          @if(dr["img_url"].ToString() != ""){
          <b><img src="@dr["img_url"]" /></b>
          }
          <p>@Html.Raw(dr["zhaiyao"])</p>
          <div class="info">
            <span class="time">@dr["add_time"]</span>
            <span class="comm"><script type="text/javascript" src="@(config.webpath)tools/submit_ajax.ashx?action=view_comment_count&id=@dr["id"]"></script>人评论</span>
            <span class="view"><script type="text/javascript" src="@(config.webpath)tools/submit_ajax.ashx?action=view_article_click&id=@dr["id"]"></script>次浏览</span>
          </div>
        </div>
      </li>
      }
      }
    </ul>
    
    <!--页码列表-->
    <div class="page-box">
      <div class="digg">@Html.Raw(pagelist)</div>
    </div>
    <!--/页码列表-->
  </div>
  <!--/左边-->

</div>